package com.hk.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.hk.dtos.UserDTO;
import com.hk.service.UserService;

public class UserListController implements Controller{

	private UserService userService;
	
	public void setUserService(UserService userService) {
		this.userService = userService;
	}


	@Override
	public ModelAndView handleRequest(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {

		ModelAndView mv=new ModelAndView();
		
		List<UserDTO> list=userService.getUserList();
		mv.addObject("list", list);
		
		
		mv.setViewName("userList.jsp");
		
		return mv;
	}

}
